<template>
	<view class="my-order" :style="myStyle">
		<view class="top" v-if="date">
			<view class="date u-line-1">
				<image v-if="date" src="@/static/images/oder-time.png" mode="widthFix"></image>
				<view v-if="date">{{date}}</view>
			</view>
			<view class="right u-line-1"></view>
		</view>

		<view class="main">
			<u-avatar :src="img" size="150" mode="square"></u-avatar>
			<view class="right">
				<view class="title u-line-1">{{title}}</view>
				<view class="u-line-1">
					<text class="price margin-right-xl">{{price<0?'价格商议':'￥'+price}}</text>
					<text class="price margin-right-xs">{{rate}}</text>
					<text v-if="rate">评分</text>
				</view>
				<view class="sub u-line-1" v-if="subTitle">{{subTitle}}</view>
				<view class="tags u-line-1" v-if="tags.length">
					<u-tag class="tag" v-for="j in tags" :text="j" :key="j" size="mini" mode="plain"></u-tag>
				</view>
			</view>
		</view>
		
		<view class="mid">
			<slot name="mid"></slot>
		</view>

		<view class="btm">
			<view class="left">
				<text v-if="status">状态</text>
				<text class="margin-lr-xs" v-if="status">|</text>
				<text class="active" v-if="status">{{status}}</text>
			</view>
			<view class="btns">
				<slot name="btns"></slot>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			bgColor: {
				type: String,
				default: '#fff'
			},
			date: {
				type: String,
				default: ''
			},
			img: {
				type: String,
				default: ''
			},
			title: {
				type: String,
				default: ''
			},
			price: {
				type: String,
				default: ''
			},
			rate: {
				type: String,
				default: ''
			},
			subTitle: {
				type: String,
				default: ''
			},
			tags: {
				type: Array,
				default: ()=>[]
			},
			status: {
				type: String,
				default: ''
			}
		},
		data() {
			return {
				myStyle: {
					background: this.bgColor
				}
			};
		}
	}
</script>

<style lang="scss">
	.my-order {
		width: 670rpx;
		background: rgba(255, 255, 255, 1);
		border-radius: 8rpx;
		margin: 32rpx auto;
		padding: 16rpx;

		.top {
			display: flex;
			justify-content: space-between;
			align-items: center;
			padding-bottom: 8rpx;
			border-bottom: 2rpx solid rgba(232, 232, 232, 0.5);
			font-size: 24rpx;
			font-family: PingFangSC-Regular, PingFang SC;
			font-weight: 400;
			color: rgba(102, 102, 102, 1);

			.date {
				display: flex;
				align-items: center;
				width: 50%;
			}

			image {
				width: 40rpx;
				margin-left: -8rpx;
			}

			.right {
				width: 50%;
				text-align: right;
			}
		}

		.main {
			padding: 16rpx 0;
			display: flex;
			justify-content: space-between;
			align-items: center;

			.right {
				width: 460rpx;
				height: 150rpx;
				display: flex;
				flex-direction: column;
				justify-content: space-around;
				font-size: 24rpx;
				font-family: PingFangSC-Medium, PingFang SC;
				line-height: 40rpx;

				.title {
					font-weight: bold;
					color: rgba(51, 51, 51, 1);
				}

				.price {
					font-weight: 600;
					color: rgba(255, 139, 86, 1);
				}

				.sub {
					font-size: 24rpx;
					font-family: PingFangSC-Regular, PingFang SC;
					font-weight: 400;
					color: rgba(153, 153, 153, 1);
				}
				
				.tags {
					.tag {
						margin-right: 12rpx;
					}
				}
			}
		}

		.btm {
			font-size: 24rpx;
			font-family: PingFangSC-Regular, PingFang SC;
			font-weight: 400;
			color: rgba(153, 153, 153, 1);
			display: flex;
			justify-content: space-between;
			align-items: center;
			.left {
				display: flex;
				align-items: center;
				.active {
					color: #EEBC80;
				}
			}
			.btns {
				display: flex;
				justify-content: flex-end;
				.btn {
					background-color: red;
				}
			}
		}
	}
</style>
